import javax.swing.*;
import java.awt.*;
import javax.swing.BorderFactory;
import javax.swing.border.Border;
import java.awt.geom.Rectangle2D;

import static java.awt.Color.*;

/**
 * Created with IntelliJ IDEA.
 * User: Станислав
 * Date: 03.02.14
 * Time: 11:24
 * To change this template use File | Settings | File Templates.
 */
public class MainFrame {
    public static void main(String[] args) {
        int x = 260;
        int y = 120;
        double angle = 0;


        JFrame frame = new JFrame("Spinno");
        frame.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);


        Container content = frame.getContentPane();


        JPanel userPaneX = new JPanel(new BorderLayout());
        JLabel userLabeX = new JLabel("X: ");
        JTextField TextFieldX = new JTextField();
        // знать как добавить Х,У;
        userLabeX.setLabelFor(TextFieldX);
        userPaneX.add(userLabeX, BorderLayout.WEST);
        userPaneX.add(TextFieldX, BorderLayout.CENTER);

        JPanel userPaneY = new JPanel(new BorderLayout());
        JLabel userLabeY = new JLabel("Y: ");
        JTextField TextFieldY = new JTextField();
        userLabeY.setLabelFor(TextFieldY);
        userPaneY.add(userLabeY, BorderLayout.WEST);
        userPaneY.add(TextFieldY, BorderLayout.CENTER);


        JPanel userPaneCos = new JPanel(new BorderLayout());
        JLabel userLabel = new JLabel("Cos: ");
        JTextField TextFieldCos = new JTextField();
        userLabel.setLabelFor(TextFieldCos);
        userPaneCos.add(userLabel, BorderLayout.WEST);
        userPaneCos.add(TextFieldCos, BorderLayout.CENTER);

        JPanel userPaneSin = new JPanel(new BorderLayout());
        JLabel userLabe2 = new JLabel("Sin:  ");
        JTextField userTextFieldSin = new JTextField();
        userLabe2.setLabelFor(userTextFieldSin);
        userPaneSin.add(userLabe2, BorderLayout.WEST);
        userPaneSin.add(userTextFieldSin, BorderLayout.CENTER);

        JPanel panel = new JPanel(new BorderLayout());
        panel.add(userPaneCos, BorderLayout.NORTH);
        panel.add(userPaneSin, BorderLayout.CENTER);
        JPanel panel2 = new JPanel(new BorderLayout());
        panel2.add(userLabeX, BorderLayout.NORTH);
        panel2.add(userLabeY, BorderLayout.CENTER);
        content.add(panel, BorderLayout.NORTH);
        content.add(panel2, BorderLayout.CENTER);

        JPanel userPane3 = new JPanel(new BorderLayout());
        JButton play = new JButton("PLAY");
        JButton stop = new JButton("STOP");
        JButton left = new JButton("|<<");
        JButton right = new JButton(">>|");
        JButton pause = new JButton("PAUSE");

        Box box = new Box(BoxLayout.Y_AXIS);

        // create a vertical box container
        box = Box.createHorizontalBox();
        box.add(left);
        box.add(play);
        box.add(pause);
        box.add(stop);
        box.add(right);
        content.add(box, BorderLayout.SOUTH);

        frame.pack();

        for (int i = 0; i < 50; i++) {
            frame.setLocation(x, y);
            x += (int) (600 * Math.cos(angle)) >> 1;
            y += (int) (450 * Math.sin(angle)) >> 1;


            frame.setLocation(x, y);
            frame.setVisible(true);

            try {
                Thread.sleep(1300);
            } catch (InterruptedException e) {
                e.printStackTrace();  //To change body of catch statement use File | Settings | File Templates.
            }

            angle++;
            frame.setVisible(false);
            try {
                Thread.sleep(500);
            } catch (InterruptedException e) {
                e.printStackTrace();  //To change body of catch statement use File | Settings | File Templates.
            }
        }
        frame.getDefaultCloseOperation();


    }


}
